<template>
  <div>
    <div @click="onClick(el)" class="plan_item" v-for="(el,index) in list">
      <div class="star_course_item">
        <img :src="el.smallPic"/>
        <p class="ellipsis1">{{el.title}}</p>
      </div>
      <buy-lock-cover v-if="el.orderInfo.buyStatus ===0 && el.orgLevelId != 0 && el.orgLevelId"/>

    </div>
  </div>
</template>

<script>
  import BuyLockCover from "../../../../components/BuyLockCover";
  import BuyDialog from "../BuyDialog";
  import levelName from "../../../../utils/level_util";


  export default {
    props: ['list'],
    components: {BuyLockCover},
    computed: {

    },
    methods: {
      onClick(el) {
        if (el.orgLevelId != 0 && el.orgLevelId ) {
          //有等级限制的计划
          if (el.orderInfo.buyStatus === 0) {
            BuyDialog.showDialog('课程',levelName(el))
          } else {
            this.$_router.push(`/plan/${el.id}`)
          }
        } else {
          this.$_router.push(`/plan/${el.id}`)
          //无等级限制的计划
        }
      },
    }
  }
</script>

<style scoped>
  .star_course_item img {
    width: 100%;
    border-radius: 8px;
  }

  .star_course_item {
    position: relative;
  }

  .star_course_item p {
    position: absolute;
    bottom: 12px;
    right: 12px;
    color: white;
    font-size: 16px;
    font-weight: bold;
  }

  .plan_item {
    position: relative;
    margin-left: 16px;
    margin-right: 16px;
    margin-bottom: 12px;
  }

</style>
